package com.midea.ai.air.ui.more.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.midea.ai.air.R;
import com.midea.ai.air.common.BaseFragment;
import com.midea.ai.air.ui.more.MoreSettingAboutMideaAir;
import com.midea.ai.air.ui.more.MoreSettingAdviceFeedback;
import com.midea.ai.air.ui.more.MoreSettingChangePassword;
import com.midea.ai.air.ui.more.MoreSettingSoftwareUpdate;
import com.midea.ai.air.ui.more.MoreSettingUseHelp;
import com.midea.ai.air.view.ListItemView;

/**
 * Created by ouyangdi on 2015/12/16.
 * 更多—>设置页面Fragment
 */
public class SettingListFragment extends BaseFragment implements View.OnClickListener{

    private ListItemView mChangePw, mAdviceFeedback, mUserHelp, mCheckUpdate, mAbout;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_more_setting, container, false);
        initViews(view);
        return view;
    }

    private void initViews(View view) {
        mChangePw = (ListItemView)view.findViewById(R.id.item_change_pw);
        mChangePw.setOnClickListener(this);

        mAdviceFeedback = (ListItemView)view.findViewById(R.id.item_suggestion_feedback);
        mAdviceFeedback.setOnClickListener(this);

        mUserHelp = (ListItemView)view.findViewById(R.id.item_user_help);
        mUserHelp.setOnClickListener(this);

        mCheckUpdate = (ListItemView)view.findViewById(R.id.item_check_update);
        mCheckUpdate.setOnClickListener(this);

        mAbout = (ListItemView)view.findViewById(R.id.item_about);
        mAbout.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.item_change_pw:
                startActivity(new Intent(getActivity(), MoreSettingChangePassword.class));
                break;
            case R.id.item_suggestion_feedback:
                startActivity(new Intent(getActivity(), MoreSettingAdviceFeedback.class));
                break;
            case R.id.item_user_help:
                startActivity(new Intent(getActivity(), MoreSettingUseHelp.class));
                break;
            case R.id.item_check_update:
                startActivity(new Intent(getActivity(), MoreSettingSoftwareUpdate.class));
                break;
            case R.id.item_about:
                startActivity(new Intent(getActivity(), MoreSettingAboutMideaAir.class));
                break;
        }
    }
}
